<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
	<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
	<jsp:include page="/common/css.jsp"/>
	<div class="sidebar">
        <div class="sidebar-dropdown"><a href="#">导航</a></div>
        <ul id="nav">
          <!-- Main menu with font awesome icon -->
          <li><a href="${pageContext.request.contextPath}/jsps/index.jsp" class="open"><i class="icon-home"></i> 首页</a></li>
         </ul>
    </div>
    <div id="d22"></div>
	<jsp:include page="/common/js.jsp"/>
	<script type="text/javascript">
	   //设置初始化参数
	var setting={
			check:{
				enable:true //可以显示全部的复选框
			},
			data:{
				simpleData:{
					enable:true,
					idKey:"uuid",
					pIdKey:"puuid",
					rootPId:"0",//设置根植
				}
			}
	};
	    
	   //进行初始化
	   $(function(){
		   $.ajax({
			   url:"${pageContext.request.contextPath}/findMenus.action",
			   type:"POST",
			   dataType:"json",
			   data:{},
			   success : function(result, start, resp) {
				 
				     var  str ='';
					    for(var i=0;i<result.length;i++){
					    	var s1=result[i].uuid;
					    	var str2="";
					    	str+='<li class="has_sub" value="'+result[i].uuid+'"><a href="#"><i class="icon-list-alt"></i>'+result[i].name+'<span class="pull-right"><i class="icon-chevron-right"></i></span></a><ul>';
					    	for(var j=1;j<result.length;j++){
					    		if(s1==result[j].puuid){
						    		str2+='<li value="'+result[j].uuid+'"><a href="${pageContext.request.contextPath}/'+result[j].url+'" >'+result[j].name+'</a></li>';
						    		i++;
						    	}
						    }
					    		str=str+str2+"</ul></li>";
					    }    
						$("#nav").append(str); 
				   
				   
				   
				   $(window).resize(function()
							  {
							    if($(window).width() >= 765){
							      $(".sidebar #nav").slideDown(350);
							    }
							    else{
							      $(".sidebar #nav").slideUp(350); 
							    }
						});

						$("#nav > li > a").on('click',function(e){
							      if($(this).parent().hasClass("has_sub")) {
							        e.preventDefault();
							      }   

							      if(!$(this).hasClass("subdrop")) {
							        // hide any open menus and remove all other classes
							        $("#nav li ul").slideUp(350);
							        $("#nav li a").removeClass("subdrop");
							        
							        // open our new menu and add the open class
							        $(this).next("ul").slideDown(350);
							        $(this).addClass("subdrop");
							      }
							      
							      else if($(this).hasClass("subdrop")) {
							        $(this).removeClass("subdrop");
							        $(this).next("ul").slideUp(350);
							      } 
							      
						});
							  
							  
						$(".sidebar-dropdown a").on('click',function(e){
							      e.preventDefault();
							      if(!$(this).hasClass("open")) {
							        // hide any open menus and remove all other classes
							        $(".sidebar #nav").slideUp(350);
							        $(".sidebar-dropdown a").removeClass("open");
							        
							        // open our new menu and add the open class
							        $(".sidebar #nav").slideDown(350);
							        $(this).addClass("open");
							      }
							      
							      else if($(this).hasClass("open")) {
							        $(this).removeClass("open");
							        $(".sidebar #nav").slideUp(350);
							      }
						});
					} 
				});
			});
	</script>


	

	
	  <div class="zTreeDemoBackground left">
	    <ul id="tree1" class="ztree"> </ul>
	  </div> 
	
	
	<!-- <div class="sidebar">
        <div class="sidebar-dropdown"><a href="#">导航</a></div>

        - Sidebar navigation
        If the main navigation has sub navigation, then add the class "has_sub" to "li" of main navigation.
        <ul id="nav" style="">
          Main menu with font awesome icon
          <li><a href="index.html" class="open"><i class="icon-home"></i> 首页</a>
            Sub menu markup 
            <ul>
              <li><a href="#">Submenu #1</a></li>
              <li><a href="#">Submenu #2</a></li>
              <li><a href="#">Submenu #3</a></li>
            </ul>
          </li>
          <li class="has_sub"><a href="#"><i class="icon-list-alt"></i> 插件页面  <span class="pull-right"><i class="icon-chevron-right"></i></span></a>
            <ul>
              <li><a href="widgets1.html">插件页面 #1</a></li>
              <li><a href="widgets2.html">插件页面 #2</a></li>
              <li><a href="widgets3.html">插件页面 #3</a></li>
            </ul>
          </li>  
          <li class="has_sub"><a href="#"><i class="icon-file-alt"></i> 页面模块1 <span class="pull-right"><i class="icon-chevron-right"></i></span></a>
            <ul>
              <li><a href="post.html">表单Post</a></li>
              <li><a href="login.html">登录页</a></li>
              <li><a href="register.html">注册页面</a></li>
              <li><a href="support.html">帮助页</a></li>
              <li><a href="invoice.html">购物清单</a></li>
              <li><a href="profile.html">个人资料</a></li>
              <li><a href="gallery.html">相册页面</a></li>
            </ul>
          </li> 
          <li class="has_sub"><a href="#"><i class="icon-file-alt"></i> 页面模块2  <span class="pull-right"><i class="icon-chevron-right"></i></span></a>
            <ul>
              <li><a href="media.html">媒体</a></li>
              <li><a href="statement.html">描述</a></li>
              <li><a href="error.html">错误</a></li>
              <li><a href="error-log.html">错误日志</a></li>
              <li><a href="calendar.html">日历</a></li>
              <li><a href="grid.html">网格</a></li>
            </ul>
          </li>                             
          <li><a href="charts.html"><i class="icon-bar-chart"></i>图表</a></li> 
          <li><a href="tables.html"><i class="icon-table"></i>表格</a></li>
          <li><a href="forms.html"><i class="icon-tasks"></i>表单</a></li>
          <li><a href="ui.html"><i class="icon-magic"></i>UI图标</a></li>
          <li><a href="calendar.html"><i class="icon-calendar"></i>日历</a></li>
        </ul>
    </div>
 
   
           -->